/*
 * @(#)DBActionResult.java 0.0.1-SNAPSHOT
 * Copyright Group B
 */

package grupb.upf.DBManager.impl;

import java.util.List;

/**
 * <p>This methods implements the management of the actions to the database
 * and returns OK/KO and the cause of the failure.</p>
 *
 * @version    0.0.1-SNAPSHOT
 * @author     Group B
 */
public final class DBActionResult implements grupb.upf.DBManager.DBActionResult
{
    /**
     * The exeception.
     */
    private Throwable ex;
    /**
     * The error.
     */
    private String error;
    /**
     * The result.
     */
    private List result;

    /**
     * Returns the result of the action.
     * @return The result of the action
     */
    @Override
    public boolean isOk() {
        if ((ex == null) && (error == null)) {
            return true;
        }
        return false;
    }
    /**
     * This methods gets an error in the action.
     * @return The error.
     */
    @Override
    public String getErrorMsg() {
        return error;
    }
    /**
     * This method gets an execption in the action.
     * @return The exeception
     */
    @Override
    public Throwable getException() {
        return ex;
    }
    /**
     * This method returns the result of an action.
     * @return the result
     */
    @Override
    public List getResult() {
        return result;
    }
    /**
     * This methods sets an error message.
     * @param aErrorMsg The error message
     */
    @Override
    public void setErrorMsg(final String aErrorMsg) {
        this.error = aErrorMsg;
    }
    /**
     * This method sets an execption.
     * @param aException The execption
     */
    @Override
    public void setException(final Throwable aException) {
        this.ex = aException;
    }
    /**
     * This method returns the result of the action.
     * @param aResult The result of the action
     */
    @Override
    public void setResult(final List aResult) {
        this.result = aResult;
    }
}
